<!DOCTYPE html>
<html>

<include file="./Application/Admin/View/common/css-js.html"/>

<body class="gray-bg">
<div style="padding-left:1%">
    <br>
    <h2>贷款</h2>
    <span style="display:block;padding-bottom:0.5%;font-size:18Px">
        贷款数: <span class='text-danger'>{$count}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <if condition="$count==0">
           贷款总金额:  <span class='text-danger'>0万元</span>
       <else/>
        贷款总金额:  <span class='text-danger'>{$countMoney}万元</span>
       </if>
    </span>
    <div style="border:1px solid #CCCCCC;"></div>
</div>
<form method="post"  action="/index.php/admin/search/search">
<div class="wrapper wrapper-content animated fadeInRight">
            <div class="btn-group btn-group-sm" style="float:left;">
                <button class="btn btn-default btn-sm" type="button" data-toggle="refresh"><a href="/index.php/admin/index/loanlist"><i class="fa fa-refresh"></i></a></button>

            </div>
<div style="float:left">

    <select  onchange="selectChange(this.options[this.selectedIndex].text)" id="select" name="select" style="width:100px;height:30px;padding:0 5px;">
        <option value="">请选择</option>
        <option value="loan_name">贷款类型</option>
        <option value="agent_name">推荐人姓名</option>
        <option value="name">借款人姓名</option>
        <option value="tel">手机号</option>
        <option value="id_number">身份证号</option>
        <option value="borrow_money">借款金额</option>
        <option value="city">城市</option>
        <input type="hidden" id="select_content" name="select_name">
    </select>
    <div style="float:right">
        <input type="text"   name="keyword" value="" style="width:300px;height:30Px" placeholder="请输入关键词">
        <span>
            <button class="btn btn-sm btn-primary" id="search" type="submit" onclick="searchuser()"> 搜索</button>
        </span>
    </div>

</div>
</div>
</form>


<div class="row" style="padding-left:1%">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>借贷列表</h5>

                </div>
                <div class="ibox-content">

                    <table class="footable table table-stripped toggle-arrow-tiny" data-page-size="20">
                        <thead>
                        <tr>

                            <th data-toggle="true">borrower_id</th>
                            <th>用户id</th>
                            <th>推荐人姓名</th>
                            <th>借款人姓名</th>
                            <th>贷款类型</th>
                            <th>借款金额</th>
                            <th>手机号</th>
                            <th>城市</th>
                            <th>身份证号</th>
                            <th>工资</th>
                            <th>申请期限</th>
                            <th>公积金</th>
                            <th>本地社保</th>
                            <th>房产面积</th>
                            <th>房产类型</th>
                            <th>是否有车</th>
                            <th>信用情况</th>
                            <th>借款时间</th>
                            <th>审核状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody >
                        <volist name="loan" id="vo" >
                            <tr>
                                <td>{$vo.borrower_id}</td>
                                <td>{$vo.register_id}</td>
                                <td>{$vo.agent_name}</td>
                                <td>{$vo.name}</td>
                                <td>{$vo.loan_name}</td>
                                <td>{$vo.borrow_money}万元</td>
                                <td>{$vo.tel}</td>
                                <td>{$vo.city}</td>
                                <td>{$vo.id_number}</td>
                                <td>{$vo.salary}</td>
                                <td>{$vo.apply_limit}</td>
                                <td>{$vo.is_fund}</td>
                                <td>{$vo.is_sec}</td>
                                <td>{$vo.area}</td>
                                <td>{$vo.type}</td>
                                <td>{$vo.is_car}</td>
                                <td>{$vo.credit}</td>
                                <td>{$vo.dateandtime}</td>
                                <td>
                                    <a id="pass{$vo.borrower_id}" style="display:none;color:#FF2C37;font-weight:bold">已审核</a>
                                    <a onclick="unpass({$vo.borrower_id})" id="unpass{$vo.borrower_id}" style="color:#FF2C37;font-weight:bold">{$vo.status}</a>
                                </td>
                                <td><a href="/index.php/admin/index/editloan?borrower_id={$vo.borrower_id}"><i class="fa fa-check text-navy"></i> 修改</a>
                                    <a href="/index.php/admin/index/delloan?borrower_id={$vo.borrower_id}">  删除</a>
                                </td>
                            </tr>
                        </volist  >
                        </tbody>
                        <tfoot>
                        <td colspan="20" style="text-align: center;font-size: 15px">
                            {$page}
                        </td>
                        </tfoot>
                    </table>

                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function() {

        $('.footable').footable();

    });

    function unpass($borrower)
    {
        var pass = document.getElementById("pass"+$borrower);
        var pass_txt = document.getElementById("pass"+$borrower).text;
        var unpass = document.getElementById("unpass"+$borrower);
        unpass.style.display="none";
        pass.style.display="block";
        $.ajax({
            url:"/index.php/admin/index/pass",
            type:"post",
            data:{"pass_txt":pass_txt,"borrower":$borrower},
            datatype:"json",
            success:function(msg){
            }
        });
    }
    function selectChange(a)
    {
        document.getElementById("select_content").value=a;
    }
    function searchuser()
    {
        var select = document.getElementById("select");
        var index = select.selectedIndex;
        var value = select.options[index].value;
        if(value=="")
        {
            document.getElementById("search").disabled="ture";
        }
    }
</script>

</body>

</html>
